home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / mkutil21.zip / SRC / UTIL / TRIMLIB.C < prev    next >
C/C++ Source or Header  |  1994-08-23  |  2KB  |  62 lines

  1. /****************************************************************************
  2. *
  3. *                    Copyright (C) 1994 SciTech Software.
  4. *                            All rights reserved.
  5. *
  6. * Filename:        $RCSfile: trimlib.c $
  7. * Version:        $Revision: 1.1 $
  8. *
  9. * Language:        Borland C++ 3.1 (not tested with anything else)
  10. * Environment:    MSDOS
  11. *
  12. * Description:    Simple program to process the response file for the Watcom
  13. *                linker wlink, to remove the empty 'LIBR' statement that
  14. *                our makefiles generate (cant seem to find a way to get
  15. *               DMAKE to automatically remove this if there are no libraries
  16. *                to be linked with the executable file).
  17. *
  18. * $Id: trimlib.c 1.1 1994/08/22 11:12:16 kjb Exp $
  19. *
  20. ****************************************************************************/
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <ctype.h>
  26.  
  27. int main(int argc, char *argv[])
  28. {
  29.     int        status,i;
  30.     char    buf[255],*p;
  31.     FILE    *infile,*outfile;
  32.  
  33.     if (argc != 3) {
  34.         fprintf(stderr, "Usage: trimlib <infile> <outfile>\n");
  35.         return -1;
  36.         }
  37.  
  38.     if ((infile = fopen(argv[1], "rt")) == NULL) {
  39.         printf("Unable to open input file!\n");
  40.         exit(1);
  41.         }
  42.     if ((outfile = fopen(argv[2], "wt")) == NULL) {
  43.         printf("Unable to open output file!\n");
  44.         exit(1);
  45.         }
  46.  
  47.     while (fgets(buf,255,infile)) {
  48.         if (strncmp(buf,"LIBR", 4) == 0) {
  49.             p = &buf[4];
  50.             while (isspace(*p) && *p != '\n')
  51.                 p++;
  52.             if (*p == '\n' || *p == '\0')
  53.                 continue;
  54.             }
  55.         fputs(buf,outfile);
  56.         }
  57.  
  58.     fclose(infile);
  59.     fclose(outfile);
  60.     return 0;
  61. }
  62.